<?php

namespace Database\Factories;

use App\Helpers\Faker;
use App\Models\ESCluster;
use Illuminate\Database\Eloquent\Factories\Factory;

/**
 * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\ESBattery>
 */
class ESBatteryFactory extends Factory
{
    /**
     * Define the model's default state.
     *
     * @return array<string, mixed>
     */
    public function definition(): array
    {
        $battery = Faker::brand('battery');
        return [
            'name' => $this->faker->numberBetween(0, 6) . '号',
            'brand' => $battery['brand'],
            'begin_at' => $this->faker->dateTimeBetween($startDate = '-3 years', $endDate = '-2 years')->format('Y-m-d'),  
            'production_date' => $this->faker->dateTimeBetween($startDate = '-5 years', $endDate = '-3 years')->format('Y-m-d'), 
            'type' => $this->faker->randomElement(['磷酸铁锂','三元锂电池']),
            'manufacturer' => $battery['company'],
            'capacity' => $this->faker->randomDigit()*10,
            'chip' => $this->faker->randomElement(['比亚迪半导体','宁德时代半导体']),
            'use_type' => $this->faker->randomElement(['梯次利用','未梯次利用']),
            'form' => $this->faker->randomElement(['自由组合','自由组合']),
            'cooling' => $this->faker->randomElement(['强制风冷','强制风冷']),
            // 'info' => '',
            'remarks' => '',
            'e_s_cluster_id' =>  $this->faker->randomElement(ESCluster::all()->pluck('id')),
        ];
    }
}
